package com.xiaoshuidi.cloud.module.member.util;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.MonthDay;
import java.util.Date;

public class CustomDateUtil {
    public static boolean isBetween(Date startDate, Date endDate, LocalDateTime time) {
        return DateUtil.isIn(new DateTime(time), startDate, endDate);
    }

    public static boolean isDateBetween(Date startDate, Date endDate, Date time) {
        return DateUtil.isIn(time, startDate, endDate);
    }

    public static boolean todayIsBirthday(LocalDate birthday) {
        LocalDate nowDate = LocalDate.now();
        MonthDay monthDay = MonthDay.from(birthday);
        MonthDay nowMonthDay = MonthDay.from(nowDate);
        return monthDay.equals(nowMonthDay);
    }

    public static boolean checkEffective(LocalDate effectiveDate) {
        LocalDate nowDate = LocalDate.now();
        return effectiveDate.compareTo(nowDate)<0;
    }

    public static void main(String[] args) {

        LocalDate effectiveDate = LocalDate.of(2023,12,16);

        System.out.println(checkEffective(effectiveDate));
    }

}
